#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n, x;
	cin>>n;
	set<int> a, b;
	for(int i = 1;i <= n;i++)
	{
		cin>>x;
		b.insert(x);
	}
	
	for(int i = 1;i <= 2*n;i++)
		if(b.count(i) == 0)
			a.insert(i);
	
	int ans = 0;
	for(auto i = b.begin();i != b.end();i++)
	{
		auto idx = a.lower_bound(*i);
		if(idx == a.end())
			continue;
		else
			{
				ans++;
				a.erase(idx);
			}
	}
	cout<<ans;
	return 0;
}
